<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>User Details</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            margin: 0;
            padding: 0;
        }
        h1 {
            text-align: center;
            color: #333;
        }
        .user-details {
            max-width: 600px;
            margin: 20px auto;
            padding: 20px;
            background-color: white;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        .user-details p {
            margin: 10px 0;
        }
        .user-details form {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        .user-details input, .user-details button {
            padding: 10px;
            font-size: 16px;
        }
        .user-details button {
            background-color: #007BFF;
            color: white;
            border: none;
            cursor: pointer;
            border-radius: 5px;
        }
        .user-details button:hover {
            background-color: #0056b3;
        }
        a {
            display: block;
            text-align: center;
            margin-top: 20px;
            padding: 10px 20px;
            background-color: #007BFF;
            color: white;
            text-decoration: none;
            border-radius: 5px;
        }
        a:hover {
            background-color: #0056b3;
        }
    </style>
</head>
<body>
<h1>User Details</h1>

<div class="user-details">
    <p><strong>ID:</strong> <span th:text="${user.id}"></span></p>
    <p><strong>Name:</strong> <span th:text="${user.name}"></span></p>
    <p><strong>Age:</strong> <span th:text="${user.age}"></span></p>
    <p><strong>Email:</strong> <span th:text="${user.email}"></span></p>

    <form th:action="@{/users/{id}/edit(id=${user.id})}" method="post">
        <label for="name">Name:</label>
        <input type="text" id="name" name="name" th:value="${user.name}" required>

        <label for="age">Age:</label>
        <input type="number" id="age" name="age" th:value="${user.age}" required>

        <label for="email">Email:</label>
        <input type="email" id="email" name="email" th:value="${user.email}" required>

        <button type="submit">Save Changes</button>
    </form>

    <a href="/users">Back to User List</a>
</div>
</body>
</html>
